﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PM.Web.Admin
{
    public partial class admin_website_gov_newslist : System.Web.UI.Page
    {
        public int RecordNum;
        protected void Page_Load(object sender, EventArgs e)
        {
            Common.CheckGovOnline();
            if (!IsPostBack)
            {
                bindData();
            }
        }

        private void bindData()
        {
            DataAccess.PmData dal = new DataAccess.PmData();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt = dal.GetGovNewsList(Common.GetCommunityCode(), int.Parse(Session["GovId"].ToString()), null, null);
            AspNetPager1.RecordCount = dt.Rows.Count; RecordNum = dt.Rows.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.DataSource = dt.DefaultView;
            this.repNewsList.DataSource = pds;
            this.repNewsList.DataBind();
        }

        protected void btnReload_Click(object sender, EventArgs e)
        {
            bindData();
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            bindData();
        }
    }
}